import request from '@/utils/request.js'

/**
 * 登录
 * @param loginParams
 */
export function login(loginParams) {
    return request.post('/login', loginParams)
}

/**
 * 注册
 * @param loginParams
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function register(loginParams) {
    return request.post('/register', loginParams)
}

/**
 * 获取个人中心作品或收藏作品
 * @param page
 * @param size
 * @param type
 * @param param
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function personAllOrCollectWork(page, size, type, param) {
    return request.get('/person/collect', {
        params: {
            page: page,
            size: size,
            type: type,
            searchParam: param
        }
    })
}

/**
 * 获取个人中心信息
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function personInfo() {
    return request.get('/person/info')
}

/**
 * 修改图片
 * @param imgUrl
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function editImage(imgUrl) {
    return request.get('/edit/img', {
        params: {
            imgUrl: imgUrl
        }
    })
}
